package Inner_Class;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 86184
 * Date: 2023-02-11
 * Time: 10:06
 */

class OuterClass2{
    public int data1=1;
    int data2=2;
    public static int data3=3;

    /**
     * 1.如何获取 静态内部类的对象？
     *      OuterClass2.InnerClass2 innerClass2=new OuterClass2.InnerClass2(); 不需要外部类对象
     * 2.静态内部类当中，不能访问外部类中的非静态成员，需要通过外部类的对象才能引用
 *          非要访问：OuterClass2 outClass1=new OuterClass2();
     *              System.out.println(outClass1.data1);
     *              System.out.println(outClass1.data2);
     *
     */
    static class InnerClass2{
        public int data4=4;
        int data5=5;
        public static int data6=6;
        public void func1(){
            System.out.println("InnerClass::func1");
            OuterClass2 outClass1=new OuterClass2();
            System.out.println(outClass1.data1);
            System.out.println(outClass1.data2);

            System.out.println(data3);
            System.out.println(data4);
            System.out.println(data5);
            System.out.println(data6);
        }
    }
    public void func2(){
        System.out.println("OuterClass::func2");
    }
}

public class StaticClass {
    public static void main(String[] args) {
        OuterClass2.InnerClass2 innerClass2=new OuterClass2.InnerClass2();
    }
}
